
# def test(x, y):
#     print(f'x = {x}')
#     print(f'y = {y}')
# test(x=10, y=20)
# test(y=100, x=200)
# def add(x, debug=False, y):
#     if debug:
#         print(f'调试信息: x={x}, y={y}')
#     return x + y
# print(add(10, 20))
# def add(x, y, debug=False):
#     if debug:
#         print(f'调试信息: x={x}, y={y}')
#     return x + y
# print(add(10, 20))
# print(add(10, 20, True))
# def factor(n):
#     return n * factor(n - 1)
# result = factor(5)
# print(result)
# def factor(n):
#     if n == 1:
#         return 1
#     return n * factor(n - 1)
# result = factor(5)
# print(result)
# def a():
#     num1 = 10
#     print("函数 a")
# def b():
#     num2 = 20
#     a()
#     print("函数 b")
# def c():
#     num3 = 30
#     b()
#     print("函数 c")
# def d():
#     num4 = 40
#     c()
#     print("函数 d")
# d()
# def a():
#     print("函数 a")
# def b():
#     a()
#     print("函数 b")
# def c():
#     b()
#     print("函数 c")
# def d():
#     c()
#     print("函数 d")
# d()
# def a():
#     print("函数 a")
# def b():
#     print("函数 b")
#     a()
# def c():
#     print("函数 c")
#     b()
# def d():
#     print("函数 d")
#     c()
# d()
# def test():
#  print("执行函数内部代码")
#  print("执行函数内部代码")
#  print("执行函数内部代码")
# # 判定是否是奇数
# def isOdd(num):
#     if num % 2 == 0:
#         return False
#     else:
#         return True
# result = isOdd(10)
# print(result)
# def test():
#     print("执行函数内部代码")
#     print("执行函数内部代码")
#     print("执行函数内部代码")
#     print("1111")
# test()
# print("2222")
# test()
# print("3333")
# for i in range(1, 10):
#     print(f'函数内部 i = {i}')
# print(f'函数外部 i = {i}')
# x = 20
# def test():
#     global x
#     x = 10
#     print(f'函数内部 x = {x}')
# test()
# print(f'函数外部 x = {x}')
# x = 20
# def test():
#      print(f'x = {x}')
# test()
# x = 20
# def test():
#     x = 10
#     print(f'函数内部 x = {x}')
# test()
# print(f'函数外部 x = {x}')
# def getPoint():
#     x = 10
#     y = 20
#     return x, y
# getPoint()
# print(x, y)
# def getPoint():
#     x = 10
#     y = 20
#     return x, y
# x, y = getPoint()
# def getPoint():
#     x = 10
#     y = 20
#     return x, y
# _, b = getPoint()
# print(b)
# print(a)
# def getPoint():
#     x = 10
#     y = 20
#     return x, y
# a, b = getPoint()
# # 判定是否是奇数
# def isOdd(num):
#     if num % 2 == 0:
#         return False
#     return True
# result = isOdd(10)
# print(result)
# # 判定是否是奇数
# def isOdd(num):
#     if num % 2 == 0:
#         return False
#     else:
#         return True
# result = isOdd(10)
# print(result)
# def calcSum(beg, end):
#     sum = 0
#     for i in range(beg, end + 1):
#         sum += i
#     return sum
# result = calcSum(1, 100)
# print(result)
# def calcSum(beg, end):
#     sum = 0
#     for i in range(beg, end + 1):
#         sum += i
#     print(sum)
# calcSum(1, 100)
# def test(a):
#  print(a)
# test(10)
# test('hello')
# test(True)
# def test(a, b, c):
#     print(a, b, c)
# test(10)
# # 定义函数
# def calcSum(beg, end):
#     sum = 0
#     for i in range(beg, end + 1):
#         sum += i
#     print(sum)
#  # 调用函数
# calcSum(1, 100)
# calcSum(300, 400)
# calcSum(1, 1000)
# test3()           # 还没有执行到定义, 就先执行调用了, 此时就会报错.
# def test3():
#     print('hello')
# def calcSum(beg, end):
#     sum = 0
#     for i in range(beg, end + 1):
#         sum += i
#     print(sum)
#  # 调用函数
# calcSum(1, 100)
# calcSum(300, 400)
# calcSum(1, 1000)